@import '../core/style/private';
@import '../core/theming/theming';
@import '../core/theming/private';

@mixin mat-autocomplete-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);
  $foreground: map-get($config, foreground);
  $background: map-get($config, background);

  .mat-autocomplete-panel {
    @include mat-private-theme-overridable-elevation(4, $config);
    background: mat-color($background, card);
    color: mat-color($foreground, text);

    // Selected options in autocompletes should not be gray, but we
    // only want to override the background for selected options if
    // they are *not* in hover or focus state. This change has to be
    // made here because base option styles are shared between the
    // autocomplete and the select.
    .mat-option.mat-selected:not(.mat-active):not(:hover) {
      background: mat-color($background, card);

      &:not(.mat-option-disabled) {
        color: mat-color($foreground, text);
      }
    }
  }
}

@mixin mat-autocomplete-typography($config-or-theme) {}

@mixin _mat-autocomplete-density($config-or-theme) {}

@mixin mat-autocomplete-theme($theme-or-color-config) {
  $theme: mat-private-legacy-get-theme($theme-or-color-config);
  @include mat-private-check-duplicate-theme-styles($theme, 'mat-autocomplete') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-autocomplete-color($color);
    }
    @if $density != null {
      @include _mat-autocomplete-density($density);
    }
    @if $typography != null {
      @include mat-autocomplete-typography($typography);
    }
  }
}
